package thread;

/*
 * @author zzr
 * @date: 2025/03/27  18:19
 * @description:
 */
public class ThreadDemo3 implements Runnable {
    @Override
    public void run() {
        while (true) {
            System.out.println("hello Runnable");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public static void main(String[] args) {

        Runnable runnable = new ThreadDemo3();
        Thread t = new Thread(runnable);

        t.start();

        while (true) {
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
